namespace CSharpPro._1014;

public class Demo
{
    //array.Sort();升序
    //array.Reverse();反转
    public void Testprint1()
    {
        Console.Write("请输入排序数的个数；");
        int Length = int.Parse(Console.ReadLine());
        Double[] a = new Double[Length];
        for (int i = 0; i < Length; i++)
        {
            a[i] = double.Parse(Console.ReadLine());

        }

        double temp;
        for (int i = 0; i < a.Length - 1; i++)
        {
            for (int j = 0; j < a.Length - i - 1; j++)
            {
                if (a[j] > a[j + 1])
                {
                    temp = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = temp;
                }
            }
        }

        Console.WriteLine("\n排序后的结果：");
        for (int i = 0; i < a.Length; i++)
        {
            Console.Write(a[i]);
            if (i < a.Length - 1)
                Console.Write(", ");
        }

        Console.WriteLine();
    }

}